<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<% response.setContentType("text/html; charset=UTF-8");%>
<% request.setCharacterEncoding("utf-8");%>

<%
    String type = null;
    int maTS = 0, id = 0;
    String hoten = null, username = null;
    HttpSession ss = request.getSession();
    if (ss.getAttribute("isLogin") == null) {
        response.sendRedirect("login.jsp");
    } else if (ss.getAttribute("isLogin").equals(false)) {
        response.sendRedirect("login.jsp");
    } else {
        type = ss.getAttribute("type").toString();
        if (type.equals("TS")) {
            maTS = Integer.parseInt(ss.getAttribute("maTS").toString());
            hoten = ss.getAttribute("hoten").toString();
        } else {
            id = Integer.parseInt(ss.getAttribute("id").toString());
            username = ss.getAttribute("username").toString();
        }
    }
%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Thi trắc nghiệm online</title>
        <link rel="stylesheet" href="css/style.css" type="text/css" />
        <script type="text/javascript" src="js/general_functions.js"></script>
        <script type="text/javascript" src="js/thongke.js"></script>
        <link rel="stylesheet" href="css/table_style.css" type="text/css" />
        <link rel="stylesheet" href="css/thongke.css" type="text/css" />
    </head>
    <body>

        <!-- BEGIN Header -->
        <div id="header">
            <div id="header-content">
                <h2 id="slogan">Thi trắc nghiệm online</h2>
                <ul id="header-links">
                    <li>
                        <%
                            if (type.equals("TS")) {
                                out.print(hoten);
                            } else {
                                out.print(username);
                            }
                        %>
                    </li>
                    <li><a href="logout.jsp">Đăng xuất</a></li>
                </ul>
                <!-- Menu Tabs -->
                <ul>
                    <li><a href="index.jsp" title="Trang chủ"><span>Trang chủ</span></a></li>
                    <li><a href="thi.jsp" title="Thi trắc nghiệm"><span>Thi trắc nghiệm</span></a></li>
                    <li id="current"><a href="thongke.jsp" title="Tổng hợp kết quả thi"><span>Tổng hợp kết quả thi</span></a></li>
                    <li><a href="cauhoi.jsp" title="Soạn câu hỏi"><span>Soạn câu hỏi</span></a></li>
                </ul>
            </div>
        </div>
        <!-- END Header -->


        <!-- BEGIN Content -->
        <div id="content">            
            <%
                if (type.equals("TS")) {
                    out.print("<div id='draw_chart_button'  style='display: none' class='draw_chart'><input type='button' id='button1' value='Xem biểu đồ' onclick='draw_chart();'></div>");
                    out.print("<div id='view_dsbaithi_button'  style='display: none' class='draw_chart'><input type='button' id='button2' value='Xem Danh sách bài thi' onclick='view_dsbaithi();'></div>");
                }
            %>
            
            <br/>
            <div id="graph-region" style="display: block">
            </div>
            <div id="dsbaithi-region" style="display: block">
                <h1 style="text-align:center;">DANH SÁCH BÀI THI</h1>
                <div id="dsbaithi"></div>
            </div>
        </div>

        <script type="text/javascript">
            <%
                String currentpage = request.getParameter("page");
                if (currentpage == null) {
                    currentpage = "1";
                }
                if (type.equals("TS")) {
                    out.println("load(" + currentpage + ", 0, " + Integer.toString(maTS) + ");");
                } else {
                    out.println("load(" + currentpage + ", 1, 0);");
                }
            %>
        </script>

        <!-- END Content -->

        <!-- BEGIN footer -->
        <div id="footer">
            <div id="footer-content">
                <div class="footer-left">
                    <p style="text-align: right">
                        &copy; copyright 2006-2011 <strong class="separator">www.styleshout.com</strong>
                    </p>
                </div>
            </div>
        </div>
        <!-- END footer -->

    </body>
</html>
